package com.forum.pojo;
// default package

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;


/**
 * Subitem entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name="t_subitem"
    ,catalog="forum"
)

public class Subitem  implements java.io.Serializable {


    // Fields    

     private Integer itemid;
     private User user;
     private String itemname;
     private String profile;
     private Integer postnum;
     private Integer clicknum;
     private Set<Post> posts = new HashSet<Post>(0);


    // Constructors

    /** default constructor */
    public Subitem() {
    }

	/** minimal constructor */
    public Subitem(User user, String itemname) {
        this.user = user;
        this.itemname = itemname;
    }
    
    /** full constructor */
    public Subitem(User user, String itemname, String profile, Integer postnum, Integer clicknum, Set<Post> posts) {
        this.user = user;
        this.itemname = itemname;
        this.profile = profile;
        this.postnum = postnum;
        this.clicknum = clicknum;
        this.posts = posts;
    }

   
    // Property accessors
    @GenericGenerator(name="generator", strategy="increment")@Id @GeneratedValue(generator="generator")
    
    @Column(name="itemid", unique=true, nullable=false)

    public Integer getItemid() {
        return this.itemid;
    }
    
    public void setItemid(Integer itemid) {
        this.itemid = itemid;
    }
	@ManyToOne(fetch=FetchType.LAZY)
        @JoinColumn(name="sectioner", nullable=false)

    public User getUser() {
        return this.user;
    }
    
    public void setUser(User user) {
        this.user = user;
    }
    
    @Column(name="itemname", nullable=false, length=31)

    public String getItemname() {
        return this.itemname;
    }
    
    public void setItemname(String itemname) {
        this.itemname = itemname;
    }
    
    @Column(name="profile", length=31)

    public String getProfile() {
        return this.profile;
    }
    
    public void setProfile(String profile) {
        this.profile = profile;
    }
    
    @Column(name="postnum")

    public Integer getPostnum() {
        return this.postnum;
    }
    
    public void setPostnum(Integer postnum) {
        this.postnum = postnum;
    }
    
    @Column(name="clicknum")

    public Integer getClicknum() {
        return this.clicknum;
    }
    
    public void setClicknum(Integer clicknum) {
        this.clicknum = clicknum;
    }
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="subitem")

    public Set<Post> getPosts() {
        return this.posts;
    }
    
    public void setPosts(Set<Post> posts) {
        this.posts = posts;
    }
   








}